package com.gec.zhs.controller;

import java.util.List;

import com.gec.zhs.entity.query.DataprivilegeruleQuery;
import com.gec.zhs.entity.po.Dataprivilegerule;
import com.gec.zhs.entity.vo.ResponseVO;
import com.gec.zhs.service.DataprivilegeruleService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 系统授权规制表 Controller
 */
@RestController("dataprivilegeruleController")
@RequestMapping("/dataprivilegerule")
public class DataprivilegeruleController extends ABaseController{

	@Resource
	private DataprivilegeruleService dataprivilegeruleService;
	/**
	 * 根据条件分页查询
	 */
	@RequestMapping("/loadDataList")
	public ResponseVO loadDataList(DataprivilegeruleQuery query){
		return getSuccessResponseVO(dataprivilegeruleService.findListByPage(query));
	}

	/**
	 * 新增
	 */
	@RequestMapping("/add")
	public ResponseVO add(Dataprivilegerule bean) {
		dataprivilegeruleService.add(bean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 批量新增
	 */
	@RequestMapping("/addBatch")
	public ResponseVO addBatch(@RequestBody List<Dataprivilegerule> listBean) {
		dataprivilegeruleService.addBatch(listBean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 批量新增/修改
	 */
	@RequestMapping("/addOrUpdateBatch")
	public ResponseVO addOrUpdateBatch(@RequestBody List<Dataprivilegerule> listBean) {
		dataprivilegeruleService.addBatch(listBean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 根据Id查询对象
	 */
	@RequestMapping("/getDataprivilegeruleById")
	public ResponseVO getDataprivilegeruleById(String id) {
		return getSuccessResponseVO(dataprivilegeruleService.getDataprivilegeruleById(id));
	}

	/**
	 * 根据Id修改对象
	 */
	@RequestMapping("/updateDataprivilegeruleById")
	public ResponseVO updateDataprivilegeruleById(Dataprivilegerule bean,String id) {
		dataprivilegeruleService.updateDataprivilegeruleById(bean,id);
		return getSuccessResponseVO(null);
	}

	/**
	 * 根据Id删除
	 */
	@RequestMapping("/deleteDataprivilegeruleById")
	public ResponseVO deleteDataprivilegeruleById(String id) {
		dataprivilegeruleService.deleteDataprivilegeruleById(id);
		return getSuccessResponseVO(null);
	}
}